// 操作模板
export function execute (operate, success) {
    return new Promise((resolve, reject) => {
        if (operate == null) {
            if (success) {
                success()
            }
            resolve()
        } else {
            operate.then(response => {
                let data = response.data
                if (response.status === 200 && data.code === 20000) {
                    if (success) {
                        success(data.data)
                    }
                    resolve(data)
                } else {
                    reject(data)
                }
            }).catch(reason => {
                reject(reason)
            })
        }
    })
}
